<?php

namespace App\Http\Requests\Api\V1_6_6;

use Illuminate\Foundation\Http\FormRequest;

class ModifyPasswordRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'old_password'=>'required|min:6|max:18',
            'password'=>'required|min:6|max:18|confirmed',
            'password_confirmation' => 'required|min:6',
        ];
    }

    public function messages()
    {
        return [
            'old_password.required'=>'原密码不能为空',
            'old_password.min'=>'原密码至少6位',
            'old_password.max'=>'原密码最多18位',
            'password.required'=>'密码不能为空',
            'password.min'=>'密码至少6位',
            'password.max'=>'密码最多18位',
            'password.confirmed'=>'两次输入的密码不一致',
            'password_confirmation.required' => '重复密码不能为空',
            'password_confirmation.min' => '重复密码至少6位',
        ];
    }
}
